package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.ToastUtils;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityTransferBinding;
import flc.ast.utils.UsEventConst;
import stark.common.basic.event.EventStatProxy;
import stark.common.basic.event.usersys.IUserSysEvent;
import stark.common.basic.event.usersys.UserSysEventProxy;

public class TransferActivity extends BaseAc<ActivityTransferBinding> {


    @Override
    protected int onCreate() {
        return R.layout.activity_transfer;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent5(this, mDataBinding.event5Container);

        mDataBinding.ivTransferBack.setOnClickListener(v -> onBackPressed());

        mDataBinding.ivTransferRecord.setOnClickListener(this);
        mDataBinding.ivFileReceive.setOnClickListener(this);
        mDataBinding.llPictureTransfer.setOnClickListener(this);
        mDataBinding.llVideoTransfer.setOnClickListener(this);
        mDataBinding.llAudioTransfer.setOnClickListener(this);
        mDataBinding.llAppTransfer.setOnClickListener(this);
        mDataBinding.llContactTransfer.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.ivTransferRecord://传输记录
                startActivity(TransferRecordActivity.class);
                break;
            case R.id.ivFileReceive://文件接收
                startActivity(FileScanQrActivity.class);
                break;
            case R.id.llPictureTransfer://图片传输
                UserSysEventProxy.getInstance().payEventWithFreeNumOfTimes(this, UsEventConst.pic_transfer, 2, new IUserSysEvent.IPayEventCallback() {
                    @Override
                    public void onPayOk(boolean isRealOk) {
                        if (isRealOk) {
                            startActivity(PicTransferActivity.class);
                        } else {
                            ToastUtils.showShort(getString(R.string.free_num_is_finish));
                        }
                    }
                });
                break;
            case R.id.llVideoTransfer://视频传输
                UserSysEventProxy.getInstance().payEventWithFreeNumOfTimes(this, UsEventConst.video_transfer, 2, new IUserSysEvent.IPayEventCallback() {
                    @Override
                    public void onPayOk(boolean isRealOk) {
                        if (isRealOk) {
                            startActivity(VideoTransferActivity.class);
                        } else {
                            ToastUtils.showShort(getString(R.string.free_num_is_finish));
                        }
                    }
                });
                break;
            case R.id.llAudioTransfer://音频传输
                UserSysEventProxy.getInstance().payEventWithFreeNumOfTimes(this, UsEventConst.audio_transfer, 2, new IUserSysEvent.IPayEventCallback() {
                    @Override
                    public void onPayOk(boolean isRealOk) {
                        if (isRealOk) {
                            startActivity(AudioTransferActivity.class);
                        } else {
                            ToastUtils.showShort(getString(R.string.free_num_is_finish));
                        }
                    }
                });
                break;
            case R.id.llAppTransfer://应用传输
                UserSysEventProxy.getInstance().payEvent(this, new IUserSysEvent.IPayEventCallback() {
                    @Override
                    public void onPayOk(boolean isRealOk) {
                        if (isRealOk) {
                            startActivity(AppTransferActivity.class);
                        } else {
                            ToastUtils.showShort(getString(R.string.not_vip));
                        }
                    }
                });
                break;
            case R.id.llContactTransfer://联系人传输
                UserSysEventProxy.getInstance().payEventWithFreeNumOfTimes(this, UsEventConst.contacts_transfer, 2, new IUserSysEvent.IPayEventCallback() {
                    @Override
                    public void onPayOk(boolean isRealOk) {
                        if (isRealOk) {
                            startActivity(ContactsTransferActivity.class);
                        } else {
                            ToastUtils.showShort(getString(R.string.free_num_is_finish));
                        }
                    }
                });
                break;
        }
    }

    @Override
    protected void initData() {

    }
}